import ajax from '@/utils/HttpUtil'
import { baseUrl as API_HOST } from '/env'

/**
 * 删除或批量删除
 * @const
 * @type {String}
 * @default  '[API_HOST]/report/reportdataset/delete'
 */
export const POST_REPORTDATASET_DELETE = API_HOST + '/report/reportdataset/delete'

/**
 * 删除或批量删除
 * @param {object} [data] 发送键值对数据
 * @param {object} [options] ajax参数选项
 * @returns {Promise}
 */
export function postReportdatasetDelete(data, options) {
  return ajax({
    method: 'post',
    data: data,
    url: POST_REPORTDATASET_DELETE,
    ...options
  })
}

/**
 * 执行数据集
 * @const
 * @type {String}
 * @default  '[API_HOST]/report/reportdataset/executeDataSet'
 */
export const POST_REPORTDATASET_EXECUTE_DATA_SET = API_HOST + '/report/reportdataset/executeDataSet'

/**
 * 执行数据集
 * @param {object} [data] 发送键值对数据
 * @param {object} [options] ajax参数选项
 * @returns {Promise}
 */
export function postReportdatasetExecuteDataSet(data, options) {
  return ajax({
    method: 'post',
    data: data,
    url: POST_REPORTDATASET_EXECUTE_DATA_SET,
    ...options
  })
}

/**
 * 详情
 * @const
 * @type {String}
 * @default  '[API_HOST]/report/reportdataset/info/:id'
 */
export const GET_REPORTDATASET_INFO_ID = API_HOST + '/report/reportdataset/info/:id'

/**
 * 详情
 * @param {string|number} id Url参数id
 * @param {object} [data] 发送键值对数据
 * @param {object} [options] ajax参数选项
 * @returns {Promise}
 */
export function getReportdatasetInfoId(id, data, options) {
  return ajax({
    method: 'get',
    params: {
      id
    },
    data: data,
    url: GET_REPORTDATASET_INFO_ID,
    ...options
  })
}

/**
 * 分页查询
 * @const
 * @type {String}
 * @default  '[API_HOST]/report/reportdataset/list'
 */
export const POST_REPORTDATASET_LIST = API_HOST + '/report/reportdataset/list'

/**
 * 分页查询
 * @param {object} [data] 发送键值对数据
 * @param {object} [options] ajax参数选项
 * @returns {Promise}
 */
export function postReportdatasetList(data, options) {
  return ajax({
    method: 'post',
    data: data,
    url: POST_REPORTDATASET_LIST,
    ...options
  })
}

/**
 * 不分页查询
 * @const
 * @type {String}
 * @default  '[API_HOST]/report/reportdataset/listAll'
 */
export const POST_REPORTDATASET_LIST_ALL = API_HOST + '/report/reportdataset/listAll'

/**
 * 不分页查询
 * @param {object} [data] 发送键值对数据
 * @param {object} [options] ajax参数选项
 * @returns {Promise}
 */
export function postReportdatasetListAll(data, options) {
  return ajax({
    method: 'post',
    data: data,
    url: POST_REPORTDATASET_LIST_ALL,
    ...options
  })
}

/**
 * 新增
 * @const
 * @type {String}
 * @default  '[API_HOST]/report/reportdataset/save'
 */
export const POST_REPORTDATASET_SAVE = API_HOST + '/report/reportdataset/save'

/**
 * 新增
 * @param {object} [data] 发送键值对数据
 * @param {object} [options] ajax参数选项
 * @returns {Promise}
 */
export function postReportdatasetSave(data, options) {
  return ajax({
    method: 'post',
    data: data,
    url: POST_REPORTDATASET_SAVE,
    ...options
  })
}

/**
 * 测试数据转换
 * @const
 * @type {String}
 * @default  '[API_HOST]/report/reportdataset/testTransform'
 */
export const POST_REPORTDATASET_TEST_TRANSFORM = API_HOST + '/report/reportdataset/testTransform'

/**
 * 测试数据转换
 * @param {object} [data] 发送键值对数据
 * @param {object} [options] ajax参数选项
 * @returns {Promise}
 */
export function postReportdatasetTestTransform(data, options) {
  return ajax({
    method: 'post',
    data: data,
    url: POST_REPORTDATASET_TEST_TRANSFORM,
    ...options
  })
}

/**
 * 修改
 * @const
 * @type {String}
 * @default  '[API_HOST]/report/reportdataset/update'
 */
export const POST_REPORTDATASET_UPDATE = API_HOST + '/report/reportdataset/update'

/**
 * 修改
 * @param {object} [data] 发送键值对数据
 * @param {object} [options] ajax参数选项
 * @returns {Promise}
 */
export function postReportdatasetUpdate(data, options) {
  return ajax({
    method: 'post',
    data: data,
    url: POST_REPORTDATASET_UPDATE,
    ...options
  })
}
